slow pokes
Some program let users initiate responses that take a long time to complete, like seconds instead of milliseconds. Users get antsy after a second or two.  They expect programs to be responsive.

You'll probably want to let users break out of slow-poke responses.  Users sometimes realize they entered a bad starting value and want to change it.  Sometimes users didn't realize how long an operation would take and changed their mind.  And sometimes they just plain pressed the wrong button!

But your program isn't going to see this "break" message until it returns to the message loop, right?  And your program won't return to the message loop until it finishes its slow-poke response.

Wow. What a dilemma. Right?

Actually, it's no problem.  Have your slow-poke functions process pending messages occasionally, perhaps this way:

  XgrProcessMessages ( 0 )
  IF #breakOut THEN RETURN

XgrProcessMessages(0) returns immediately if no messages are waiting in the message queue, otherwise it processes one message and returns.  If a processed message sets #breakOut and your function returns as a result, well, that solves delay and lock-up problems, doesn't it?

advanced message processing
Most applications contain a call to XgrProcessMessages(1) in their entry function, and perhaps a couple slow-poke checks like the one described above.  But occasionally sophisticated programs need to do something tricky.  Fortunately, GuiDesigner message loops are accessible and a whole arsenal of message processing functions are available, including:

Message Processing...
  XuiSendMessage ( grid, message, v0, v1, v2, v3, kid, r1 )
  XuiSendToKid ( grid, message, v0, v1, v2, v3, kid, r1 )
  XuiSendStringMessage ( grid, message$, v0, v1, v2, v3, kid, r1 )

Message Queue Processing...
  XgrAddMessage ( grid, message, v0, v1, v2, v3, r0, r1 )
  XgrDeleteMessages ( count )
  XgrGetMessages ( @count, @messages[] )
  XgrGetMessageType ( message, @messageType )
  XgrJamMessage ( grid, message, v0, v1, v2, v3, r0, r1 )
  XgrMessageNameToNumber ( messageName$, @messageNumber )
  XgrMessageNames ( @count, messages$[] )
  XgrMessageNumberToName ( messageNumber, @messageName$ )
  XgrPeekMessage ( @grid, @message, @v0, @v1, @v2, @v3, @r0, @r1 )
  XgrProcessMessages ( count )
  XgrRegisterMessage ( @messageNumber, messageName$ )